<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>商城首页</title>
    <link rel="stylesheet" type="text/css" href="${basePath }/public/css/common.css">
    <script type="text/javascript" src="${basePath}/public/js/jquery.min.js"></script>
    <script type="text/javascript">
        function select() {
            var name = $("#a").val();
            window.location.href="${basePath}/home/homepage/like?name="+name;
        }
        function register() {
            var txtUserName= $("#txtUserName").val();
            var txtPassword= $("#txtPassword").val();
            var txtMobile= $("#txtMobile").val();
            var txtEmail= $("#txtEmail").val();
            $.ajax({
                url:"${basePath}/vipUser",
                type:"post",
                data:{
                    txtUserName:txtUserName,
                    txtPassword:txtPassword,
                    txtMobile:txtMobile,
                    txtEmail:txtEmail
                },
                success:function (result) {
                    if (result.status==1){
                        alert("注册成功！请登陆")
                        window.location.href="${basePath}/home/vipUser/toLogin"
                    } else {
                        alert("注册失败")
                    }
                }
            })
        }
    </script>
</head>
<body>
<div class="top-header">
    <div class="section">
        <div class="top-header-left f-left">
            <a href="#">LOGO</a>
        </div>
        <div class="top-header-right f-right">
            <c:choose>
                <c:when test="${empty user}">
                    <a href="${basePath}/home/vipUser/toLogin">登录</a>
                    <a href="${basePath}/home/vipUser/toRegisterVip">注册</a>
                    <a href="${basePath}/admin/adminUser/toLogin">后台</a>
                </c:when>
                <c:otherwise>
                    <a href="#">欢迎你!<W style="color: bisque;font-weight: bold; font-family: 微软雅黑; font-size: 20px;">${user.username}</W></a>
                    <a href="${basePath}/admin/adminUser/toLogin">后台</a>
                    <a href="${basePath}/home/vipUser/write">注销</a>
                </c:otherwise>
            </c:choose>
        </div>
    </div>
</div>

<div class="section nav-header">
    <ul class="nav-menus f-left">
        <li><a href="${basePath}/home/homepage/index" class="active">首页</a></li>
        <li><a href="${basePath}/home/homepage/toProductList">产品列表</a></li>
        <li><a href="${basePath}/home/cart">购物车</a></li>
        <li><a href="${basePath}/home/vipUser/index" >会员中心</a></li>
        <li><a href="${basePath}/home/News/toNews">新闻资讯</a></li>
        <li><a href="${basePath}/home/pay/contact">联系我们</a></li>
    </ul>
    <div class="f-right nav-right">
        <input type="text" class="seacher-input f-left" placeholder="输入关键字">
        <a class="seacher-but  f-left" onclick="select()">搜索</a>
    </div>
</div>


<div class="section">
    <div class="nav-tit">
        <a class="selected" href="${basePath}/home/vipUser/toRegisterVip">会员注册</a>
        <i>|</i>
        <a href="${basePath}/home/vipUser/toLogin">账户登录</a>
    </div>

    <form id="regform" >
        <div class="form-box full">
            <dl class="form-group">
                <dt>用 户 名：</dt>
                <dd>
                    <input id="txtUserName" name="username" type="text" class="input" placeholder="输入登录用户名" >
                    <span class="Validform_checktip">请输入登录的用户名</span>
                </dd>
            </dl>
            <dl class="form-group">
                <dt>密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码：</dt>
                <dd>
                    <input id="txtPassword" name="password" type="password" class="input" placeholder="输入登录密码" >
                    <span class="Validform_checktip">请输入6-20位的登录密码</span>
                </dd>
            </dl>
            <dl class="form-group">
                <dt>确认密码：</dt>
                <dd>
                    <input id="txtPassword1" name="yesPassword" type="password" class="input" placeholder="请再次输入密码" >
                    <span class="Validform_checktip">请再次输入登录密码</span>
                </dd>
            </dl>

            <!--开放注册及手机注册-->
            <dl class="form-group">
                <dt>手&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;机：</dt>
                <dd>
                    <input id="txtMobile" name="phone" type="text" class="input" placeholder="输入手机号码" >
                    <span class="Validform_checktip">请输入手机号码</span>
                </dd>
            </dl>
            <!--/开放注册及手机注册-->

            <!--开放注册及邮箱邀请注册-->
            <dl class="form-group">
                <dt>邮&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;箱：</dt>
                <dd>
                    <input id="txtEmail" name="email" type="text" class="input" placeholder="输入邮箱账号" >
                    <span class="Validform_checktip">请输入电子邮箱账号</span>
                </dd>
            </dl>
            <!--/开放注册及邮箱邀请注册-->

            <!--/开放注册-->
            <dl class="form-group">
                <dd>

                    <input id="btnSubmit" type="button" value="立即注册" class="submit" onclick="register()">

                </dd>
            </dl>
        </div>
    </form>
</div>


<div class="section qitian-main">
    <img src="${basePath}/public/images/qitian.png">
</div>

<div class="footer-copyright">
    <p>软信商城©2013-2017 软信大学版权所有 京ICP备17017089号 京公网安备11000002000006号</p>
</div>
</body>
</html>